package com.ltt.controller;

import com.ltt.annotation.NoAuth;
import com.ltt.dao.pojo.Season;
import com.ltt.dao.pojo.Solar;
import com.ltt.dao.vo.Result;
import com.ltt.service.SeasonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ‘李天泰’
 * @version 1.0
 * @description: TODO
 * @date 2023/5/4 8:47
 */
@Api(tags = "课程模块")
@RestController
@RequestMapping("/season")
public class SeasonController {
    @Autowired
    private SeasonService service;

    @NoAuth
    @ApiOperation("获取所有的节气")
    @GetMapping("/find")
    public Result findAllSeason() {
        List<Season> allSeason = service.findAllSeason();
        return Result.successWithData(allSeason);
    }

    @NoAuth
    @ApiOperation("通过名字搜索节气")
    @GetMapping("/findSolarByName")
    public Result findSolarByName(@RequestParam String name) {
        List<Solar> solarByName = service.findSolarByName(name);
        return Result.successWithData(solarByName);
    }
}
